package com.paradox.aggregation.provider;

import com.paradox.aggregation.provider.rpc.RpcTestServiceImpl;
import com.paradox.rpc.protocol.ParadoxServer;
import com.paradox.rpc.protocol.ServerFactory;
import com.paradox.rpc.registry.NativeRegistry;
import com.paradox.rpc.registry.Registry;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableFeignClients
@MapperScan("com.paradox.aggregation.provider.mapper")
@EnableAspectJAutoProxy
public class ProviderApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext= SpringApplication.run(ProviderApplication.class, args);
        applicationContext.getBean(ProviderApplication.class);
        Registry registry=new NativeRegistry();
        registry.register("com.paradox.aggregation.providerAPI.api.RpcTestService",new RpcTestServiceImpl());
        ParadoxServer server=ServerFactory.getServer("netty");
        server.start();
    }

}
